<?php

namespace common\logics;

use Yii;
use common\helpers\Url;
use yii\helpers\ArrayHelper;

/**
 * This is the model class for table "{{%user}}".
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class UserLogic extends \common\models\user\UserMeta {

    public function fields() {
        return [
            'id',
            'nickname' => 'username',
            'mobile' => function() {
                if ($this->mobile) {
                    return parent::decryptMobile();
                }
                return '';
            },
            'avatar' => function() {
                return Url::attach($this->avatar);
            },
            'cover' => function() {
                return Url::attach($this->cover);
            },
            'gender',
            'signature',
            'birthday',
            'location',
            'followed',
            'register_time' => 'created_at',
            'rongyun_token' => 'rongCloudToken',
        ];
    }

}
